﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.PurchaseFormModelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.PurchaseFormModelCommandHandler
{
	/// <summary>
	/// 羊只采购添加
	/// </summary>
	public class AddPurchaseFormsCommandHandler : IRequestHandler<AddPurchaseFormsCommand, Results<int>>
	{
		/// <summary>
		/// 构造函数
		/// </summary>
		private readonly IPurchaseFormModelService _purchaseFormModelService;
		public AddPurchaseFormsCommandHandler(IPurchaseFormModelService purchaseFormModelService)
		{
			_purchaseFormModelService = purchaseFormModelService;
		}
		/// <summary>
		/// 养只采购添加
		/// </summary>
		/// <param name="request"></param>
		/// <param name="cancellationToken"></param>
		/// <returns></returns>
		/// <exception cref="NotImplementedException"></exception>
		public async Task<Results<int>> Handle(AddPurchaseFormsCommand request, CancellationToken cancellationToken)
		{
			var adds = await _purchaseFormModelService.AddPurchaseForms(request.Inputs);
			return Results<int>.DataResult(adds);
		}
	}
}
